<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">

    <h:head>
        <p:growl widgetVar="growl" life="3000" />
    </h:head>
    <ui:composition template="/template.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.AppName}"></h:outputText>
        </ui:define>
        <ui:define name="body">

            <h:form id="BookListForm">

                <p:panel header="#{bundle.ListBookTitle}">

                    <p:dataTable id="datalist" value="#{bookController.items}" var="item"
                                 selectionMode="single" selection="#{bookController.selected}"
                                 rowKey="#{item.bookPK}"
                                 paginator="true"
                                 rows="10"
                                 rowsPerPageTemplate="10,20,30"
                                 >

                        <p:ajax event="rowSelect"   />
                        <p:ajax event="rowUnselect" />

                        <p:column sortBy="#{item.bookPK.idBook}" filterBy="#{item.bookPK.idBook}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_bookPK_idBook}"/>
                            </f:facet>
                            <h:outputText value="#{item.bookPK.idBook}"/>
                        </p:column>
                        <p:column sortBy="#{item.name}" filterBy="#{item.name}" filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_name}"/>
                            </f:facet>
                            <h:outputText value="#{item.name}"/>
                        </p:column>
                        <p:column sortBy="#{item.year}" filterBy="#{item.year}"  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_year}"/>
                            </f:facet>
                            <h:outputText value="#{item.year}"/>
                        </p:column>
                        <p:column sortBy="#{item.author}" filterBy="#{item.author}"  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_author}"/>
                            </f:facet>
                            <h:outputText value="#{item.author}"/>
                        </p:column>
                        <p:column sortBy="#{item.location}" filterBy="#{item.location}"  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_location}"/>
                            </f:facet>
                            <h:outputText value="#{item.location}"/>
                        </p:column>
                        <p:column sortBy="#{item.avaiableCopies}" filterBy="#{item.avaiableCopies}"  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_avaiableCopies}"/>
                            </f:facet>
                            <h:outputText value="#{item.avaiableCopies}"/>
                        </p:column>
                        <p:column sortBy="#{item.knowledgeArea.name}" filterBy="#{item.knowledgeArea.name}"  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_knowledgeArea}"/>
                            </f:facet>
                            <h:outputText value="#{item.knowledgeArea.name}"/>
                        </p:column>
                        <p:column sortBy="#{item.editorial.name}" filterBy="#{item.editorial.name}"  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_editorial}"/>
                            </f:facet>
                            <h:outputText value="#{item.editorial.name}"/>
                        </p:column>
                        <p:column sortBy="#{item.bookType.description}" filterBy="#{item.bookType.description}"  filterMatchMode="contains">
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListBookTitle_bookType}"/>
                            </f:facet>
                            <h:outputText value="#{item.bookType.description}"/>
                        </p:column>                      

                    </p:dataTable>

                </p:panel>


            </h:form>


        </ui:define>

    </ui:composition>


</html>